﻿@using LunwenYun.Infrastructure.Entities.Entity;
@{
    Layout = "~/Views/Shared/Main.cshtml";
}

<div class="box">
    <div class="title">
     @if (ViewBag.Success)
     {
        <h3>
            恭喜您，已经成为中国学术论文云正式会员</h3>
     }
     else { 
        <h3>
            对不起，激活失败</h3>
     }
    </div>
    <div class="box-content">
        <div class="container-fluid">
        @if (ViewBag.Success)
        {
            var user = (User)ViewBag.User;
            <h3 class="text-success">
                激活成功！</h3>
            <span>您已经成为本站正式会员</span>
            if (user.SystemRole == LunwenYun.Infrastructure.Entities.Enum.UserRole.Member)
            {
                <span>接下，您可以：</span>
                <a href="/j/mlist">查找期刊进行投稿</a>
                <a href="">发布投稿意向</a>
            }
            else
            { 
                <h3 class="text-error">请完成您的约稿人资料！</h3>
                <span>请先完善您的约稿人资料，在您完善您的约稿人资料之前，您暂时还不能参与约稿工作。</span>
                <a href="/o/profile">立刻完善约稿人资料</a>
            }
        }
        else
        {
            <h3 class="text-error">
                激活失败！</h3>
            <span>由于某些原因，您的账号激活失败。请参考以下原因，如果都不是，请与管理员联系</span>
            <hr />
            <ul>
                <li>1、人为修改url值</li>
                <li>2、您是7天之前注册的。如果是，您可以<a href="javascript:;" onclick="resendactivation()" class="btn btn-primary btn-mini">重发激活邮件</a></li>
                <li>3、再次之前您申请过忘记并重置密码操作。如果是，您可以<a href="javascript:;" onclick="resendactivation()" class="btn btn-primary btn-mini">重发激活邮件</a></li>
            </ul>
            <div style="display:none;" id="form">
                <div class="control-group">
                    <label class="control-label">
                        请输入用户名：</label>
                    <div class="controls">
                        <input type="text" class="span4" id="txtUsername" placeholder="输入您注册时使用的用户名" />
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">
                        </label>
                    <div class="controls">
                        <input type="button" class="btn btn-primary" onclick="doresend()" value="重新发送" />
                    </div>
                </div>
            </div>
        }
        </div>
    </div>
</div>

@section tail{
    <script type="text/javascript">
        function resendactivation() {
            $('#form').show();
        }
        function doresend() {
            if ($('#txtUsername').val() == '') {
                $('#txtUsername').parent().parent().addClass('error');
                $('#txtUsername').parent().append($('<span>输入有误</span>'));
                return;
            }
            $.ajax({
                url: '/account/resend',
                method: 'get',
                data:{u:$('#txtUsername').val(),t:0},
                success: function (result) {
                    if (result == '1') {
                        window.location.href = '/account/operationdone?t=4';
                    }
                    else { 
                        alert('用户不存在，请查证');
                    }
                }
            });
        }
    </script>
}